#pragma once

#ifdef FUREPORTGENERATOR_EXPORTS
#define FUREPORTGENERATOR_API __declspec(dllexport)
#else
#define FUREPORTGENERATOR_API __declspec(dllimport)

#ifdef _DEBUG
#pragma comment(lib,"cppx.report.generator_d.lib")
#else
#pragma comment(lib,"cppx.report.generator.lib")
#endif

#endif

//////////////////////////////////////////////////////////////////////////
#define TEMPLATE_TYPE_NONE			-1
#define TEMPLATE_TYPE_SECTION		0
#define TEMPLATE_TYPE_TITLE_PAGE	1
#define TEMPLATE_TYPE_SUMMARY_PAGE	2

#define FIELD_TYPE_NONE		0
#define FIELD_TYPE_GRID		1
#define FIELD_TYPE_FIELD	2
#define FIELD_TYPE_LABEL	3
#define FIELD_TYPE_BOX		4
#define FIELD_TYPE_ELLIPSE	5
#define FIELD_TYPE_LINE		6
#define FIELD_TYPE_PICTURE	7

#include <vector>
#include <string>
using namespace std;
typedef vector<string>	StringArray;

class FUREPORTGENERATOR_API ReportGenerator
{
	struct pimpl_t;
	struct pimpl_t * pimpl_;

public:
	ReportGenerator(void);
	~ReportGenerator(void);
	
	// Operations
	string  GetReportname	( void );
	void	SetReportname	( const char * value );
	bool	SetReportfile	( const char * filename );

    bool	Add				( int field, const char * data );
	bool	Add				( const char * field, const char * data );
	bool	Add				( const char * field, StringArray & data );

	bool	FillGrid		( const char * field, int rows, int cols, const char * data = "");
	bool	ReplaceCell		( const char * field, int row,  int col,  const char * data );

	void	New				( void );
	void	Clear			( void );

	void	Print			( HDC hdc );
	void	PrintPage		( HDC hdc, int page=0 );
	int		CalculatePages	( void );

	string	GetErrorMessage	( void );

	// Data
	int		GetTemplateSize	( int tplte = 0 );
	string	GetFieldName	( int field, int tplate = 0 );
	int		GetFieldType	( const char * field, int tplate = -1 );
	int		GetFieldColumns	( const char * field, int tplate = -1 );

	bool	AddTemplate		( const char * filename, int type = TEMPLATE_TYPE_SECTION );

	void	ResizeField		( const char * field );
};
